﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodePlex.TfsPluginSuite.Configuration
{
    [ConfigurationCollection(typeof(PatternBypassOverrideConfigElement), AddItemName = "PatternBypass", CollectionType = ConfigurationElementCollectionType.BasicMap)]
    public class PatternBypassOverrideConfigElementCollection : ConfigurationElementCollection
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return new PatternBypassOverrideConfigElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            var overrideElement = element as PatternBypassOverrideConfigElement;
            return string.Concat(overrideElement.PathRegex, overrideElement.ChangeType);
        }

        [ConfigurationProperty("enabled", DefaultValue = (bool)false)]
        public bool Enabled
        {
            get
            {
                return (bool)base["enabled"];
            }
        }
    }
}
